package com.itheima.web3.web;

import com.alibaba.fastjson2.JSON;
import com.itheima.web3.pojo.User;
import com.itheima.web3.util.Result;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


@WebServlet("/v1/test")
public class TestServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String username = req.getParameter("username");
        String password = req.getParameter("password");



        User user = new User();
        user.setUsername(username);
        user.setPassword(password);

        resp.getWriter().println(JSON.toJSONString(Result.getResult(0,"测试成功",user)));
    }
}
